home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / tttool30.arc / MANUAL.TTT < prev    next >
Text File  |  1987-02-17  |  97KB  |  3,826 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.                              TechnoJocks Turbo Toolkit
  20.  
  21.                                     Version 3.0
  22.  
  23.                              Released: October 1, 1986
  24.  
  25.  
  26.  
  27.                       "In the software business since Tuesday"
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.                                         CONTENTS
  76.  
  77.  
  78.  
  79.  
  80.  
  81.             Section 1     INTRODUCTION ...............................  3
  82.  
  83.             Section 2     OTHER GOODIES FOR YOUR TOOLKIT .............  5
  84.  
  85.             Section 3     HOW THE TOOLKIT WORKS ......................  7
  86.  
  87.             Section 4     FASTWRIT.TTT ...............................  8
  88.  
  89.             Section 5     WINDOW.TTT ................................. 25
  90.  
  91.             Section 6     MENU.TTT ................................... 31
  92.  
  93.             Section 7     IO.TTT ..................................... 36
  94.  
  95.             Section 8     MISC.TTT ................................... 42
  96.  
  97.             Index         List of all Procedures and Functions ....... 55
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 2
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.        Section 1 INTRODUCTION
  142.  
  143.  
  144.  
  145.  
  146.        The Toolkit  is a  collection of  procedures and  functions for  Turbo
  147.        Pascal programmers.  It is  designed to  speed up the time it takes to
  148.        write  applications  and  can  be  a  considerable  productivity  aid,
  149.        especially for the less experienced programmer.
  150.  
  151.  
  152.        The Toolkit  evolved from  a need  to develop procedures and functions
  153.        for  my  own  applications.  They  are  not  a  comprehensive  set  of
  154.        procedures covering the breadth and depth of applications programming.
  155.        They concentrate  on screen  orientated applications for CGA systems ,
  156.        to the  exclusion of  disk IO  and printer control. If you are looking
  157.        for a more comprehensive library see Section 2.
  158.  
  159.  
  160.        The TTT (TechnoJocks Turbo Toolkit) disk contains the following files:
  161.  
  162.  
  163.        Decl.TTT       - All the Type, Const and Var declaration required by
  164.                         the procedures and functions.
  165.  
  166.        FastWrit.TTT   - A collection of ultra-fast screen writing procedures
  167.                         which are all based on an "Inline" screen update
  168.                         procedure.
  169.  
  170.        Window.TTT     - A collection of windowing and screen saving
  171.                         procedures.
  172.  
  173.        Menu.TTT       - A very nice (better than Blaise) menu routine.
  174.  
  175.        IO.TTT         - A collection of screen input routines.
  176.  
  177.        Misc.TTT       - A host of miscellaneous procedures and functions.
  178.  
  179.        ?????TTT.DEM   - Demonstration examples in the use of the Toolkit.
  180.  
  181.        ?????TTT.com   - Compiled versions of the above .DEM files.
  182.  
  183.        README.TTT     - Latest Documentation for the Toolkit.
  184.  
  185.        Manual.TTT     - This documentation.
  186.  
  187.        Please  distribute  this  Toolkit  to  fellow  Turboholics,  the  only
  188.        distribution conditions  are that  the code  must not  be modified  or
  189.        altered, and that no fee must be charged. Enough crap!
  190.  
  191.  
  192.  
  193.  
  194.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 3
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.        The quickest  way of  getting a quick appreciation of the capabilities
  208.        of  the   Toolkit  is   to  execute   the  program  DemoTTT.com.  This
  209.        demonstrates most  of the procedures and functions available. The Demo
  210.        itself was, of course, written with the Toolkit. If you haven't run it
  211.        yet, run it now!
  212.  
  213.        There are 5 other demonstration programs in the toolkit. They are much
  214.        smaller and  are designed  to simply  demonstrate one specific part of
  215.        the Toolkit.  The source code is provided and are useful illustrations
  216.        of the coding simplicity.
  217.  
  218.        The heart  of the  Toolkit are the files with TTT extensions; they are
  219.        the source code for all the procedures and functions.
  220.  
  221.        Finally, TechnoJocks  NO NONSENSE  LICENSE STATEMENT!  If any  part of
  222.        this package  is in  any way  faulty  it's  not  Technojocks  problem,
  223.        especially if  you screw  up big  and try to blame me!. If you do find
  224.        any problems or bugs (!) or can recommend improvements, let me know.
  225.  
  226.        Bitches, gripes, thanks, kisses, donations (not in that order!) to:
  227.  
  228.  
  229.  
  230.                                 Bob Ainsbury
  231.                                 Technojock
  232.                                 P.O. Box 2197
  233.                                 Houston  TX  77252
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 4
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.        Section 2 OTHER GOODIES FOR YOUR TOOLKIT
  274.  
  275.  
  276.  
  277.        Over the past twelve months I have scoured the earth for good tools to
  278.        help me  with applications  development in  Turbo Pascal. This section
  279.        simply details  what I think are the best of the crop. The tools range
  280.        from shareware/freeware,  to individual  developers,  and  on  to  the
  281.        professional development companies.
  282.  
  283.        STAYRES        If you ever need to write "terminate and stay resident"
  284.                       programs then  the STAYRES  procedures are  a must. The
  285.                       latest version  (at press time) is 4.10. The utility is
  286.                       shareware and  is available  on the main Turbo Bulletin
  287.                       Boards (see  the end  of this section). The utility was
  288.                       developed by  The Hunters  Helper Lane Ferris et al. If
  289.                       you are unable to locate a copy, contact:
  290.  
  291.                                 Lane Ferris
  292.                                 4268 26th St
  293.                                 San Francisco, Ca. 94131
  294.                                 Compuserv 70357,2716
  295.  
  296.        EXEC           This small  (but not  simple) utility allows you to run
  297.                       other programs  from within  a  turbo  program.  It  is
  298.                       straight forward to use and free. The latest version is
  299.                       1.2. The  utility  was  developed  by  Bela  Lubkin  of
  300.                       Borland International Technical Support.
  301.  
  302.        BOOSTERS       George F  Smith has  developed a  comprehensive set  of
  303.                       procedures and  functions covering  a  whole  range  of
  304.                       needs. All  his utilities are well documented and ULTRA
  305.                       fast. The are nearly all Inline based and are orintated
  306.                       to IBM and true compatibles.The latest version is 1.02.
  307.                       Like  the   Toolkit,   these   utilities   are   screen
  308.                       orientated, but  they include extensive string handling
  309.                       and an  alternative to EXEC (mentioned above). Boosters
  310.                       is available  on the main Turbo Bulletin Boards, but if
  311.                       you are unable to locate a copy, contact:
  312.  
  313.                                 George F. Smith
  314.                                 609 Candlewick Lane,
  315.                                 LilBurn, GA 30247
  316.                                 (404) 923-6879
  317.  
  318.        VSCREEN        The Vscreen  package contains  a very powerful array of
  319.                       window  routines   (no  other   package  comes  close),
  320.                       together  with   a  comprehensive   set  of  screen  IO
  321.                       routines. The  only weakness  of the package is that if
  322.                       you use VScreen utilities, the whole of the application
  323.                       needs to  adopt the VScreen rules, and the code size is
  324.                       large. Nonetheless it is a good package. A demo version
  325.  
  326.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 5
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.                       is  available  on  the  bulletin  boards.  For  further
  338.                       information, contact:
  339.  
  340.                                 Northpoint Software
  341.                                 1817 Domanik Drive
  342.                                 Racine, WI 53404
  343.                                 (414) 637-7540
  344.  
  345.        BLAISE         There is  no doubt  in my  mind that Blaise Power Tools
  346.                       Plus is  the most  comprehensive set of tools for Turbo
  347.                       Pascal. They  are professionally  written and very well
  348.                       documented. The  tools cover  the breadth  and depth of
  349.                       needs from file IO to memory resident and beyond. There
  350.                       are two  drawbacks. Firstly,  a price  tag  of  $99.95.
  351.                       Secondly, the procedures can be slow to compile because
  352.                       of the  extensive error  checking that takes place, and
  353.                       the  deeply   nested  include  file  approach.  Overall
  354.                       though,  it   is  a  very  professional,  good  quality
  355.                       product. For further information contact:
  356.  
  357.                            Blaise Computing Inc.
  358.                            2560 Ninth Street
  359.                            Suite 316
  360.                            Berkeley, CA 94710
  361.                            (415) 540-5441
  362.  
  363.        SOURCEPRINT -  If you want the best formatted printouts available then
  364.                       I suggest  you put  your hand  in your  pocket and  buy
  365.                       SourcePrint. There is now a friendly screen driven menu
  366.                       that saves  you worrying  about all  the setup strings,
  367.                       and the  latest version provides a wealth of formatting
  368.                       options.  SourcePrint   retails  for   $139.00  and  is
  369.                       available from:
  370.  
  371.                            Alderbaran Laboratories
  372.                            3339 Vincent Dr.
  373.                            Pleasant Hill, CA 94523
  374.                            (800) 257 5773
  375.  
  376.        If you are new to Turbo Pascal, I suggest you buy the Turbo Tutor
  377.        version 2.0 from Borland International. If you are not completely
  378.        penniless, I also recommend you buy Jeff Duntemann's "Complete Turbo
  379.        Pascal". Finally, consider joining TUG; the very well run Turbo Users
  380.        Group -- contact TUG, P.O. Box 1510, Poulsbo, WA 98370. As promised,
  381.        listed below are some of the bulletin boards which contain Turbo
  382.        Pascal goodies:
  383.  
  384.             High Sierra BBS, sysop David Carroll, (209) 296 3534
  385.  
  386.             Computers Unlimited, Chuck Childers,  (513) 258 0020
  387.  
  388.             Wilmington Fido, Bob Klahn,           (302) 764 7522
  389.  
  390.             Windmill, Duke Stafford,              (806) 792 6116
  391.  
  392.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 6
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.        Section 3 HOW THE TOOLKIT WORKS
  406.  
  407.  
  408.  
  409.        Basics  --  Turbo Pascal has what is called an include directive {$I}
  410.        which allows you to include source code from another file into your
  411.        main program. For example, placing the statement {$I
  412.        c:\turbo\decl.ttt} in your program will have the same effect as
  413.        merging the contents of the file decl.ttt into your program. It
  414.        provides a convenient method of maintaining a library of files. The
  415.        Toolkit is such a library. All you need to do is decide which
  416.        procedures and functions you want to use and include them in your
  417.        source code with the {$I filename} directive. Read the Turbo Pascal
  418.        v3.0 reference manual page 147 for a full explanation.
  419.  
  420.        All the  Toolkit procedures and functions require the file DECL.TTT to
  421.        be included  first. You  then simply  include the  TTT files which are
  422.        required for that particular procedure or function.
  423.  
  424.        The technique  is best  illustrated  with  an  example.  In  the  file
  425.        MISC.TTT there  is a  function, called Date, which returns the current
  426.        date in long form. A somewhat trivial program to write the date on the
  427.        screen would be as follows :
  428.  
  429.                  Program Toolkit_Example;
  430.  
  431.                  {$I Decl.TTT}
  432.                  {$I Misc.TTT}
  433.  
  434.                  begin
  435.                  Clrscr;         {clear the screen}
  436.                  Write(Date);
  437.                  end.
  438.  
  439.        In the following sections, we will discuss all the procedures and
  440.        functions in the Toolkit, and show examples of their use.
  441.  
  442.        The Appendix  contains a list of all the procedures and functions,
  443.        together with the appropriate TTT filename.
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 7
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.        Section 4 FASTWRIT.TTT
  472.  
  473.        The Fastwrit.TTT file contains a host of procedures for updating the
  474.        screen, together with cursor control procedures. Execute the file
  475.        WriteDem.com to see some of the features. Note that these procedures
  476.        are machine dependant and will only work on IBM and true compatibles
  477.        (the procedures were developed on a Compaq Deskpro 286).
  478.  
  479.        The Fastwrite core procedure is based on the original developed by
  480.        Marshall Brain, Troy, New York and published in TUG Lines Issue 9. It
  481.        also incorporates Sergio Polini's modifications.
  482.  
  483.        The following procedures are detailed in this section:
  484.  
  485.                                      Box
  486.                                      HorizLine
  487.                                      VertLine
  488.                                      WriteAT
  489.                                      ClearText
  490.                                      WriteCenter
  491.                                      WriteBetween
  492.                                      WriteVert
  493.                                      TempMessage
  494.                                      FindCursor
  495.                                      PosCursor
  496.                                      SizeCursor
  497.                                      OffCursor
  498.                                      OnCursor
  499.                                      VideoOn
  500.                                      VideoOff
  501.  
  502.  
  503.  
  504.  
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 8
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                           Section 4   Fastwrit.TTT (cont.)
  533.  
  534.  
  535.        Procedure           BOX
  536.  
  537.        Purpose             Draw rectangular box on screen
  538.  
  539.        Syntax              Box( X1,Y1,X2,Y2,F,B,Boxtype:integer);
  540.  
  541.                  where          X1        top left X coordinate (1..80)
  542.                                 Y1        top left Y coordinate (1..25)
  543.                                 X2        lower right X coord.  (1..80)
  544.                                 Y2        lower right Y coord.  (1..25)
  545.                                 F         foreground color      (0..15)
  546.                                 B         background color       (0..7)
  547.                                 Boxtype   line thickness      (1,2,3,4)
  548.  
  549.        Notes     1)   The area inside the rectangle is not cleared
  550.                  2)   The values for Boxtype are:
  551.  
  552.                                 1    Single line
  553.                                 2    Double line
  554.                                 3    Single top/bottom, double sides
  555.                                 4    Double top/bottom, single sides
  556.  
  557.                       If a Boxtype of 0 is passed then the procedure will use
  558.                       ' '  as the box character, any other value will  result
  559.                       in a single line box.
  560.  
  561.        Examples:
  562.  
  563.        {$I Decl.TTT}
  564.        {$I Fastwrit.TTT}
  565.  
  566.        begin
  567.        Clrscr;
  568.        Box(20,1,60,5,yellow,black,2);
  569.        Box(1,7,80,25,15,1,1);
  570.        end;
  571.  
  572.  
  573.  
  574.        The above code fragment would result in two boxes being drawn on the
  575.        screen. The top box would be a double yellow lined box  on a black
  576.        background, and the other larger box would be a white single lined box
  577.        on a blue background.
  578.  
  579.        Note: the color codes are available in the Turbo Pascal Reference
  580.        Manual V3.0 on page 161.
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 9
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                           Section 4   Fastwrit.TTT (cont.)
  599.  
  600.  
  601.        Procedure           HORIZLINE
  602.  
  603.        Purpose             Draw horizontal line on the screen
  604.  
  605.        Syntax              HorizLine(X1,X2,Y,F,B,Linetype:integer);
  606.  
  607.                  where          X1        left X coordinate (1..80)
  608.                                 X2        right X coordinate(1..80)
  609.                                 Y         Y coordinate      (1..25)
  610.                                 F         foreground color  (0..15)
  611.                                 B         background color   (0..7)
  612.                                 LineType  line thickness  (1,2,3,4)
  613.  
  614.        Notes     1)   The values for Linetype are:
  615.  
  616.                            1    Single
  617.                            2    Double
  618.                            3    Single
  619.                            4    Double
  620.  
  621.                  2)   X2 can be larger than X1.
  622.  
  623.        Example:
  624.  
  625.        {$I Decl.TTT}
  626.        {$I Fastwrit.TTT}
  627.  
  628.        begin
  629.        Clrscr;
  630.        HorizLine(20,60,5,lightgreen,green,1);
  631.        HorizLine(15,4,24,14,6,4);
  632.        end;
  633.  
  634.        The above code fragment would result in two lines being drawn on the
  635.        screen. The first line would be a single lightgreen line on a green
  636.        background located on line 5 (one fifth of the way down the screen),
  637.        starting at position 20 and ending at 60. The second line would draw a
  638.        double yellow line on a brown background located on line 24 (next to
  639.        last line on screen) between x coords 4 and 15.
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 10
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                           Section 4   Fastwrit.TTT (cont.)
  665.  
  666.  
  667.        Procedure           VERTLINE
  668.  
  669.        Purpose             Draw vertical line on the screen
  670.  
  671.        Syntax              HorizLine(X,Y1,Y2,F,B,Linetype:integer);
  672.  
  673.                  where          X         X coordinate      (1..80)
  674.                                 Y1        top Y coordinate  (1..80)
  675.                                 Y2        bottom Y coord    (1..25)
  676.                                 F         foreground color  (0..15)
  677.                                 B         background color   (0..7)
  678.                                 LineType  line thickness  (1,2,3,4)
  679.  
  680.        Notes     1)   The values for Linetype are:
  681.  
  682.                            1    Single
  683.                            2    Double
  684.                            3    Single
  685.                            4    Double
  686.  
  687.                  2)   X2 can be larger than X1.
  688.  
  689.        Example:
  690.  
  691.        {$I Decl.TTT}
  692.        {$I Fastwrit.TTT}
  693.  
  694.        begin
  695.        Clrscr;
  696.        Vertline(1,1,25,white,black,1);
  697.        VertLine(80,25,1,15,0,3);
  698.        end;
  699.  
  700.        The above code fragment will draw two vertical white lines on the left
  701.        and right extremes of the screen. Note that the second statement has
  702.        the Y coords in reverse order - the procedure will still function
  703.        correctly.
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 11
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                           Section 4   Fastwrit.TTT (cont.)
  731.  
  732.  
  733.        Procedure           WRITEAT
  734.  
  735.        Purpose             Writes directly to the screen el quicko
  736.  
  737.        Syntax              WriteAT(X,Y,F,B:integer;ST:string80);
  738.  
  739.                  where     X         X coord of first char in string (1..80)
  740.                            Y         Y coord of string               (1..25)
  741.                            F         foreground color                (0..15)
  742.                            B         background color                 (0..7)
  743.                            ST        text string  (up to 80 chars in length)
  744.  
  745.        Notes     1)   This procedure cannot be used to write integers/reals
  746.                  2)   You may pass concatenated strings (see code fragment)
  747.                  3)   X,Y coords outside the accepted range will result in
  748.                       the text being wrapped to the next line.
  749.  
  750.        Example:
  751.  
  752.        {$I Decl.TTT}
  753.        {$I Fastwrit.TTT}
  754.  
  755.        Const Heading = 'Toolkit';
  756.  
  757.        begin
  758.        Clrscr;
  759.        WriteAT(1,25,yellow,red,'Press F1 for help');
  760.        WriteAT(25,1,green,black,heading);
  761.        WriteAT(60,13,1,0,'Technojocks Turbo '+heading);
  762.        end;
  763.  
  764.        The above code fragment illustrates a number of different ways of
  765.        writing directly to the screen. The first statement simply writes the
  766.        help message at the bottom of the screen. The second line writes the
  767.        string constant TOOLKIT part way along the first line, and finally the
  768.        last statement would write 'Technojocks Turbo Toolkit' on the end of
  769.        the 13 th. line.
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 12
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                           Section 4   Fastwrit.TTT (cont.)
  797.  
  798.  
  799.        Procedure           CLEARTEXT
  800.  
  801.        Purpose             To clear part or all of the screen
  802.  
  803.        Syntax              ClearText(X1,Y1,X2,Y2,F,B:integer);
  804.  
  805.                  where     X1        top left X coordinate (1..80)
  806.                            Y1        top left Y coordinate (1..25)
  807.                            X2        lower right X coord   (1..80)
  808.                            Y2        lower right Y coord   (1..25)
  809.                            F         foreground color      (0..15)
  810.                            B         background color       (0..7)
  811.  
  812.        Notes     1)   This is preferred to the Turbo Pascal procedure Clrscr
  813.                       in situations where the window procedure is in effect -
  814.                       it will clear the defined area regardless of the window
  815.                       setting.
  816.                  2)   The procedure is used extensively in the TTT Window and
  817.                       Menu routines.
  818.                  3)   The foreground color sets the foreground attribute but
  819.                       does not affect the display immediately.
  820.  
  821.        Example
  822.  
  823.        {$I Decl.TTT}
  824.        {$I Fastwrit.TTT}
  825.  
  826.        begin
  827.        ClearText(1,1,40,25,0,green);
  828.        ClearText(41,1,80,25,0,red);
  829.        end;
  830.  
  831.        The above code fragment will clear the full screen, coloring the left
  832.        half green and the right half red.
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 13
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                           Section 4   Fastwrit.TTT (cont.)
  863.  
  864.  
  865.        Procedure           WRITECENTER
  866.  
  867.        Purpose             To write text on the center of a line
  868.  
  869.        Syntax              WriteCenter(LineNo,F,B:integer;ST:string80);
  870.  
  871.                  where          LineNo    the Y coord or line number
  872.        (1..25)
  873.                                 F         foreground color
  874.        (1..15)
  875.                                 B         background color
  876.        (0..7)
  877.                                 ST        text string (up to 80 chars in
  878.        length)
  879.  
  880.        Notes     1)   The same rules apply as for WriteAT i.e. no
  881.        reals/integers,
  882.                       strings may be concatenated,no checking on Y validity.
  883.  
  884.        Example
  885.  
  886.        {$I Decl.TTT}
  887.        {$I Fastwrit.TTT}
  888.  
  889.        begin
  890.        Clrscr;
  891.        WriteCenter(1,white,green,'Company Title');
  892.        WriteCenter(2,white,green,'Kato '+'Catering Company');
  893.        end;
  894.  
  895.        The above code fragment simply centers two headings on the top two
  896.        lines of the screen in white on a green background.
  897.  
  898.  
  899.  
  900.  
  901.  
  902.  
  903.  
  904.  
  905.  
  906.  
  907.  
  908.  
  909.  
  910.  
  911.  
  912.  
  913.  
  914.  
  915.  
  916.  
  917.  
  918.  
  919.  
  920.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 14
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                           Section 4   Fastwrit.TTT (cont.)
  929.  
  930.  
  931.        Procedure           WRITEBETWEEN
  932.  
  933.        Purpose             To write text centered between two points
  934.  
  935.        Syntax              WriteBetween(X1,X2,Y,F,B:integer;ST:string80);
  936.  
  937.                  where     X1        left  X coordinate             (1..80)
  938.                            X2        right X coordinate             (1..80)
  939.                            Y         the Y coord or line no         (1..25)
  940.                            F         foreground color               (0..15)
  941.                            B         background color                (0..7)
  942.                            ST        text string (up to 80 chars in length)
  943.  
  944.        Notes     1)   If the length of the string is greater than the
  945.                       distance between the X coordinates, the string will
  946.                       simply be written commencing at X1.
  947.  
  948.        Example
  949.  
  950.        {$I Decl.TTT}
  951.        {$I Fastwrit.TTT}
  952.  
  953.        Begin
  954.        Clrscr;
  955.        WriteBetween(35,70,5,green,blue,'Middle');
  956.        WriteBetween(1,80,1,white,black,'Same effect as WriteCenter');
  957.        end;
  958.  
  959.        The above code fragment would write two lines of text to the screen.
  960.        The first would write Middle on the fifth line centered between points
  961.        35 and 75. Note the second command would have the same effect as
  962.        WriteCenter.
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 15
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                           Section 4   Fastwrit.TTT (cont.)
  995.  
  996.  
  997.        Procedure           WRITEVERT
  998.  
  999.        Purpose             To write text vertically on the screen
  1000.  
  1001.        Syntax              WriteVert(X,Y,F,B:integer;ST:string80);
  1002.  
  1003.                  where     X         X coord of first char in string (1..80)
  1004.                            Y         Y coord of first char in string (1..25)
  1005.                            F         foreground color                (0..15)
  1006.                            B         background color                 (0..7)
  1007.                            ST        text string ( up to 25 chars in length)
  1008.  
  1009.  
  1010.  
  1011.        Example
  1012.  
  1013.        {$I Decl.TTT}
  1014.        {$I Fastwrit.TTT}
  1015.  
  1016.        begin
  1017.        Clrscr;
  1018.        WriteVert(40,1,red,black,'This is the middle');
  1019.        end;
  1020.  
  1021.  
  1022.        The above code fragment will simply write the text This is the middle
  1023.        down the center of the screen.
  1024.  
  1025.  
  1026.  
  1027.  
  1028.  
  1029.  
  1030.  
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.  
  1040.  
  1041.  
  1042.  
  1043.  
  1044.  
  1045.  
  1046.  
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 16
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                           Section 4   Fastwrit.TTT (cont.)
  1061.  
  1062.  
  1063.        Procedure           TEMPMESSAGE
  1064.  
  1065.        Purpose             To display a message anywhere on the screen, wait
  1066.                            for a keypress, and then restore the original
  1067.                            screen contents.
  1068.  
  1069.        Syntax              TempMessage(X,Y,F,B:integer;ST:string80);
  1070.  
  1071.                  where     X         the X coord of the first char  (1..80)
  1072.                            Y         the Y coord or the first char  (1..25)
  1073.                            F         foreground color               (0..15)
  1074.                            B         background color                (0..7)
  1075.                            ST        text string (up to 80 chars in length)
  1076.  
  1077.        Notes     1)   The procedure temporarily stores the line of text
  1078.                       together with its attributes, displays the tempoary
  1079.                       message, and after a key is pressed (any key), the
  1080.                       original text and attributes are returned to the
  1081.                       screen.
  1082.  
  1083.                  2)   The procedure is most useful when the screen is very
  1084.                       'busy' and you want to display an error or warning
  1085.                       message.
  1086.  
  1087.                  3)   The keyboard buffer is cleared so the keypress is not
  1088.                       passed back to the calling procedure i.e. you are
  1089.                       unable to determine which key was pressed.
  1090.  
  1091.        Example
  1092.  
  1093.        {$I Decl.TTT}
  1094.        {$I Fastwrit.TTT}
  1095.  
  1096.        begin
  1097.        TempMessage(1,25,yellow,red,'Unable to find file');
  1098.        end;
  1099.  
  1100.        The above code fragment will display the message Unable to find file
  1101.        until the user presses a key.
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 17
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                           Section 4   Fastwrit.TTT (cont.)
  1127.  
  1128.  
  1129.        Procedure           FINDCURSOR
  1130.  
  1131.        Purpose             Returns the location and size of the cursor
  1132.  
  1133.        Syntax              FindCursor(var X,Y,ScanTop,ScanBot:integer);
  1134.  
  1135.                  where     X         the X coord of the cursor (1..80)
  1136.                            Y         the Y coord of the cursor (1..25)
  1137.                            ScanTop   the top scan code         (0..13)
  1138.                            ScanBot   the bottom scan code      (1..13)
  1139.  
  1140.        Notes     1)   You must pass 4 variables to this procedure and they
  1141.                       will be returned with the current cursor settings.
  1142.  
  1143.                  2)   The scan codes refer to the actual location of the top
  1144.                       and bottom of the cursor within a given character
  1145.                       field, where zero is the top of the field (as is the
  1146.                       top stroke of the letter T -- got it?), and either 13
  1147.                       or 7 is the bottom of the field on monochrome or color
  1148.                       systems respectively. On a color system a ScanTop of 6
  1149.                       and a ScanBot of 7 would indicate the normal DOS type
  1150.                       cursor, or 4/7 would be a half block cursor. For more
  1151.                       information refer to the Peter Norton book 'Inside The
  1152.                       IBM PC'.
  1153.  
  1154.                  3)   The procedure is preferable to the Turbo Pascal
  1155.                       functions WhereX and WhereY because the results are not
  1156.                       affected by the Window paramaters in effect (as well as
  1157.                       returning the cursor size!).
  1158.  
  1159.        Example
  1160.  
  1161.        {$I Decl.TTT}
  1162.        {$I Fastwrite.TTT}
  1163.  
  1164.        Var LocX,LocY,Upper,Lower : integer;
  1165.  
  1166.        begin
  1167.        FindCursor(LocX,LocY,Upper,Lower);
  1168.        If (LocX in [1..40]) and (LocY in [1..15]) then ......
  1169.        end;
  1170.  
  1171.        In the above code fragment the values returned in the variables are
  1172.        the Cursor details which can subsequently be acted upon. In this case
  1173.        an if statement checks to see if the cursor is in the left half of the
  1174.        screen betwwen lines 1 and 15. See procedure SizeCursor for another
  1175.        example.
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 18
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                           Section 4   Fastwrit.TTT (cont.)
  1193.  
  1194.  
  1195.        Procedure           POSCURSOR
  1196.  
  1197.        Purpose             To relocate the cursor to any loaction on the
  1198.        screen
  1199.  
  1200.        Syntax              PosCursor(X,Y:integer);
  1201.  
  1202.                  where     X         the X coordinate of the cursor (1..80)
  1203.                            Y         the Y coordinate of the cursor (1..25)
  1204.  
  1205.        Notes     1)   This procedure is preferable to Turbo Pascal's GotoXY
  1206.                       statement when window settings are to be ignored.
  1207.  
  1208.        Example
  1209.  
  1210.        {$I Decl.TTT}
  1211.        {$I Fastwrit.TTT}
  1212.  
  1213.        begin
  1214.        PosCursor(25,80);
  1215.        end;
  1216.  
  1217.        This simple code fragment locates the cursor at the bottom right of
  1218.        the screen. See the next procedure SizeCursor for an additional
  1219.        example.
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 19
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                           Section 4   Fastwrit.TTT (cont.)
  1259.  
  1260.  
  1261.        Procedure                SIZECURSOR
  1262.  
  1263.        Purpose                  To change the shape/appearance of the cursor
  1264.  
  1265.        Syntax                   SizeCursor(Scantop,ScanBot:integer);
  1266.  
  1267.                       where          ScanTop   is the top scan line (0..14)
  1268.                                      ScanBot   is the bot scan line (0..13)
  1269.  
  1270.        Notes     1)   Refer to the procedure FindCursor for a discussion on
  1271.                       scan codes.
  1272.  
  1273.                  2)   Note that setting the top scan code will result in a
  1274.                       'hidden' cursor on both monochrome and color systems.
  1275.  
  1276.        Example
  1277.  
  1278.        {$I Decl.TTT}
  1279.        {$I Fastwrit.TTT}
  1280.  
  1281.        var PosX,PosY,Top,Bot : integer;
  1282.  
  1283.        begin
  1284.        FindCursor(PosX,PosY,Top,Bot);
  1285.        Help_System;                     {say, a procedure that changes the
  1286.        cursor}
  1287.        PosCursor(PosX,PosY);
  1288.        SizeCursor(Top,Bot);
  1289.        end;
  1290.  
  1291.        The above code fragment will determine the cursor characteristics with
  1292.        the FindCursor procedure. Another unrelated procedure is then called,
  1293.        in this example Help_System. When the Help_System procedure is
  1294.        finished, the cursor position and size is returned to its original
  1295.        state with the PosCursor and SizeCursor procedures.
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 20
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                           Section 4   Fastwrit.TTT (cont.)
  1325.  
  1326.  
  1327.        Procedure                OFFCURSOR
  1328.  
  1329.        Purpose                  A quick method of switching the cursor off
  1330.  
  1331.        Syntax                   OffCursor;
  1332.  
  1333.        Notes          1) The procedure hides the cursor on monochrome and
  1334.                       color systems.
  1335.  
  1336.        Example
  1337.  
  1338.        {$I Decl.TTT}
  1339.        {$I FastWrit.TTT}
  1340.  
  1341.        begin
  1342.        OffCursor;
  1343.        end;
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366.  
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 21
  1383.  
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                           Section 4   Fastwrit.TTT (cont.)
  1391.  
  1392.  
  1393.        Procedure           ONCURSOR
  1394.  
  1395.        Purpose             A quick way of setting the cursor to the DOS
  1396.        default
  1397.  
  1398.        Syntax              OnCursor;
  1399.  
  1400.        Notes          The procedure checks to see if the system is monochrome
  1401.                       or color and sets the cursor to an underline;
  1402.  
  1403.        Example
  1404.  
  1405.        {$I Decl.TTT}
  1406.        {$I Fastwrit.TTT}
  1407.  
  1408.        begin
  1409.        OnCursor;
  1410.        end;
  1411.  
  1412.  
  1413.  
  1414.  
  1415.  
  1416.  
  1417.  
  1418.  
  1419.  
  1420.  
  1421.  
  1422.  
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.  
  1432.  
  1433.  
  1434.  
  1435.  
  1436.  
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442.  
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 22
  1449.  
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                           Section 4   Fastwrit.TTT (cont.)
  1457.  
  1458.  
  1459.        Procedure                VIDEOOFF
  1460.  
  1461.        Purpose                  Switches off the video port to avoid CGA snow
  1462.  
  1463.        Syntax                   VideoOff;
  1464.  
  1465.        Notes          1)   Snow occurs on systems fitted with a Color
  1466.                            Graphics Adapter when direct writes to video
  1467.                            memory are performed. The Fastwrit procedures are
  1468.                            designed to minimize snow but in extreme cases you
  1469.                            may want to specifically switch off (or freeze)
  1470.                            the display while the update is undertaken -- the
  1471.                            screen can then be refreshed by issuing the
  1472.                            VideoOn command (see next procedure).
  1473.  
  1474.                       2)   In the Decl.TTT file there is a boolean variable
  1475.                            called SNOW which is set to False. If you want to
  1476.                            automatically alter the main screen updating
  1477.                            procedures simply set snow to TRUE and the TTT
  1478.                            procedures will invoke VideoOff and VideoOn as
  1479.                            necessary on large screen writes (see Window.TTT).
  1480.  
  1481.        Example
  1482.  
  1483.        {$I Decl.TTT}
  1484.        {$I Fastwrit.TTT}
  1485.  
  1486.        var I,J : integer;
  1487.  
  1488.        begin
  1489.        VideoOff;
  1490.        For I := 1 to 80 do
  1491.         For J := 1 to 25 do
  1492.          WriteAT(I,J,white,black,'$');
  1493.        VideoOn;
  1494.        end;
  1495.  
  1496.        The above code fragment freezes the screen with the VideoOff command,
  1497.        writes a $ sign at every location on the screen, and then refreshes
  1498.        the screen with the VideoOn command;
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 23
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                           Section 4   Fastwrit.TTT (cont.)
  1523.  
  1524.  
  1525.        Procedure                VIDEOON
  1526.  
  1527.        Purpose                  To switch the video on following VideoOff
  1528.  
  1529.        Syntax                   VideoOn;
  1530.  
  1531.        Notes          1)   Refer to the previous procedure VideoOff;
  1532.  
  1533.        Example
  1534.  
  1535.        {$I Decl.TTT}
  1536.        {$I Fastwrit.TTT}
  1537.  
  1538.        var I,J : integer;
  1539.  
  1540.        begin
  1541.        VideoOff;
  1542.        For I := 1 to 80 do
  1543.         For J := 1 to 25 do
  1544.          WriteAT(I,J,white,black,'$');
  1545.        VideoOn;
  1546.        end;
  1547.  
  1548.        The above code fragment freezes the screen with the VideoOff command,
  1549.        writes a $ sign at every location on the screen, and then refreshes
  1550.        the screen with the VideoOn command.
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 24
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.        Section 5  WINDOW.TTT
  1592.  
  1593.        The  Window.TTT  files  contains  both  windowing  and  screen  saving
  1594.        procedures.
  1595.  
  1596.        The Window  routines allow  you to  construct windows  with  specified
  1597.        colors, border  size and  style. A  window overlays all or part of the
  1598.        screen, but  both the screen and the cursor details are saved with the
  1599.        screen.   When the  window is removed the original screen contents are
  1600.        restored and  the cursor  is repositioned  as  necessary.  The  window
  1601.        routines are  for text  mode only and use BIOS calls which are IBM (or
  1602.        close compatible)  specific. Windows  can be  layered on  top of  each
  1603.        other as  deeply as  the system  can handle, approximately 100 (if you
  1604.        are silly enough).
  1605.  
  1606.        The screen  saving procedures  allow you  to save a screen on the heap
  1607.        (so the  64k data  limit  is  not  eaten  up  by  saved  screens)  and
  1608.        subsequently restore  them from the heap in an instant. There are also
  1609.        features to avoid snow on CGA machines.
  1610.  
  1611.        To conserve  space the  maximum number of saved screens is arbitrarily
  1612.        set to  4 and  the number of saved windows is set to 4. These maximums
  1613.        can  be  readily  modified  without  any  impairment  in  response  or
  1614.        efficiency.  There   are  two   constants  in   the  Decl.TTT  file  :
  1615.        Max_WindowsandScreens,  and  Max_Screens    --  just  adjust  them  as
  1616.        necessary.
  1617.  
  1618.        Execute the  files SavedDem.com  and WindoDem.com to see some of these
  1619.        features in action.
  1620.  
  1621.        Note that  both Decl.TTT  and Fastwrit.TTT  must  be  included  before
  1622.        Window.TTT -- window utilizes some of the procedures in Fastwrit.TTT.
  1623.  
  1624.        The following procedures are detailed in this section:
  1625.  
  1626.                                 SaveScreen
  1627.                                 RestoreScreen
  1628.                                 DisposeScreen
  1629.                                 MkWin
  1630.                                 RmWin
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 25
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.                             Section 5  Window.TTT (cont.)
  1655.  
  1656.  
  1657.        Procedure                SAVESCREEN
  1658.  
  1659.        Purpose                  To Save the screen image on the Heap
  1660.  
  1661.        Syntax                   SaveScreen(Page:byte);
  1662.  
  1663.                       where     Page is a unique page number
  1664.  
  1665.        Notes     1)   This procedure will save a full copy of the screen and
  1666.                       all the attributes (color etc.). The location of the
  1667.                       cursor is also saved.
  1668.  
  1669.                  2)   It is good practice to use page numbers starting with
  1670.                       1, but make sure there is not another page on the heap
  1671.                       saved under the same number (see procedure
  1672.                       DisposeScreen) otherwise it will be overwritten.
  1673.  
  1674.        Example
  1675.  
  1676.        {$I Decl.TTT}
  1677.        {$I Fastwrit.TTT}
  1678.        {$I Window.TTT}
  1679.  
  1680.        begin
  1681.        Savescreen(1);
  1682.        end;
  1683.  
  1684.        See the procedure DisposeScreen for a more meaningful example of
  1685.        SaveScreen.
  1686.  
  1687.  
  1688.  
  1689.  
  1690.  
  1691.  
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.  
  1712.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 26
  1713.  
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720.                             Section 5  Window.TTT (cont.)
  1721.  
  1722.  
  1723.        Procedure                RESTORESCREEN
  1724.  
  1725.        Purpose                  To restore a previously saved screen
  1726.  
  1727.        Syntax                   RestoreScreen(Page:byte);
  1728.  
  1729.                  where     Page is the same number that was specified with
  1730.                            the corresponding SaveScreen.
  1731.  
  1732.        Notes     1)   Only use the page number that was specified with a
  1733.                       previous SaveScreen, otherwise unpredictable results
  1734.                       will occur (e.g. the flashing happy faces).
  1735.  
  1736.                  2)   The restore screen will return the cursor to the
  1737.                       position it was in immediately prior to the SaveScreen.
  1738.  
  1739.                  3)   If the program is to run on a snowy graphics adapter
  1740.                       then simply set the boolean constant to TRUE prior to
  1741.                       the restore, and if prudent, set it back to false
  1742.                       afterwards. See procedure VideOff in Section 4 for a
  1743.                       further explanation of snow.
  1744.  
  1745.        Example
  1746.  
  1747.        {$I Decl.TTT}
  1748.        {$I Fastwrit.TTT}
  1749.        {$I Window.TTT}
  1750.  
  1751.        begin
  1752.        RestoreScreen(1);
  1753.        end;
  1754.  
  1755.        See the procedure DisposeScreen for a more meaningful example of
  1756.        RestoreScreen.
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.  
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777.  
  1778.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 27
  1779.  
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786.                             Section 5  Window.TTT (cont.)
  1787.  
  1788.  
  1789.        Procedure                DISPOSESCREEN
  1790.  
  1791.        Purpose                  To clear a saved screen from the heap.
  1792.  
  1793.        Syntax                   DisposeScreen(Page:byte);
  1794.  
  1795.                  where     Page is the number of a screen saved with
  1796.                            SaveScreen.
  1797.  
  1798.        Notes     1)   If you have restored a screen using RestoreScreen and
  1799.                       you no longer need the saved screen image, use this
  1800.                       procedure to trash the image and release the heapspace
  1801.                       for use by other procedures.
  1802.  
  1803.                  2)   The SaveScreen and DisposeScreen procedures use the
  1804.                       standard Turbo Pascal New/Dispose heap control
  1805.                       procedures. These should not be mixed in a program that
  1806.                       uses the exclusive alternative of Mark/Release.
  1807.  
  1808.        Example
  1809.  
  1810.        {$I Decl.TTT}
  1811.        {$I Fastwrit.TTT}
  1812.        {$I Window.TTT}
  1813.  
  1814.        begin
  1815.        Savescreen(1);
  1816.        OffCursor;
  1817.        HelpProcedure;   { any procedure which modifies the screen display }
  1818.        RestoreScreen(1);
  1819.        DisposeScreen(1);
  1820.        End;
  1821.  
  1822.        This code fragment illustrates a typical application for the TTT
  1823.        screen management procedures. Firstly the screen is saved in page 1,
  1824.        then the cursor is switched off, and another procedure is called which
  1825.        modifies all or part of the screen -- in this example, HelpProcedure.
  1826.        After the help procedure is finished, the original screen and cursor
  1827.        location are restored. Finally the saved screen, which is no longer
  1828.        required, is discarded with the DisposeScreen(1) statement.
  1829.  
  1830.        Note that the next screen could also be saved to page 1 because the
  1831.        original page 1 is now disposed of.
  1832.  
  1833.        Another application is to save menu screens after their first display
  1834.        so that they can be instantly restored at any stage in the program.
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 28
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.                             Section 5  Window.TTT (cont.)
  1853.  
  1854.  
  1855.        Procedure           MKWIN
  1856.  
  1857.        Purpose             To overlay a rectangular window on the screen
  1858.  
  1859.        Syntax              MkWin(X1,Y1,X2,Y2,F,B,boxtype:integer);
  1860.  
  1861.                  where     X1        top left X coordinate (1..80)
  1862.                            Y1        top left Y coordinate (1..25)
  1863.                            X2        lower right X coord   (1..80)
  1864.                            Y2        lower right Y coord   (1..25)
  1865.                            F         foreground color      (0..15)
  1866.                            B         background color       (0..7)
  1867.  
  1868.        Notes     1)   The specifications are the same as for the Box
  1869.                       procedure in Fastwrit.TTT i.e. Boxtype
  1870.                                 1    Single line
  1871.                                 2    Double line
  1872.                                 3    Single top/bottom, double sides
  1873.                                 4    Double top/bottom, single sides
  1874.                       A 0 boxtype will result in no box being drawn, any
  1875.                       other value will result in a single line box.
  1876.  
  1877.                  2)   Windows can be nested and overlapping but they must be
  1878.                       removed in the same order they were displayed.
  1879.  
  1880.                  3)   The window procedures use the screen saving procedures
  1881.                       discussed previously.
  1882.  
  1883.                  4)   The window inside the border is cleared to the
  1884.                       background color.
  1885.  
  1886.                  5)   The standard Turbo Pascal procedure Window is not set,
  1887.                       primarily because I do not use it. If you want to set
  1888.                       the Window coordinates simply issue a Window statement
  1889.                       following the MkWin procedure.
  1890.  
  1891.        Example
  1892.  
  1893.        See RmWin for an example of the TTT Window procedures.
  1894.  
  1895.  
  1896.  
  1897.  
  1898.  
  1899.  
  1900.  
  1901.  
  1902.  
  1903.  
  1904.  
  1905.  
  1906.  
  1907.  
  1908.  
  1909.  
  1910.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 29
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.                             Section 5  Window.TTT (cont.)
  1919.  
  1920.  
  1921.        Procedure           RMWIN
  1922.  
  1923.        Purpose             To remove a window and restore the original screen
  1924.  
  1925.        Syntax              RmWin;
  1926.  
  1927.        Notes     1)   The RmWin procedure removes the last displayed window.
  1928.                       Successive RmWin statements will remove the earlier
  1929.                       displayed window. If Rmwin is called when there are no
  1930.                       windows, the procedure simply returns i.e. no problem.
  1931.  
  1932.                  2)   The procedure utilises RestoreScreen and DisposeScreen
  1933.                       discussed previously.
  1934.  
  1935.        Example
  1936.  
  1937.        {$I Decl.TTT}
  1938.        {$I Fastwrit.TTT}
  1939.        {$I Window.TTT}
  1940.  
  1941.        begin
  1942.        MkWin(25,20,65,25,white,red,1);
  1943.        WriteBetween(25,65,23,white,red,'Are you sure you want to exit?');
  1944.        Read(Kbd,Ch);
  1945.        If upcase(Ch) = 'Y' then
  1946.         Halt
  1947.        else
  1948.         RmWin;
  1949.        end;
  1950.  
  1951.        The above code fragment paints a red window with a white single line
  1952.        border on the last five lines of the screen, and displays a message in
  1953.        the center of the box. If the user responds Y then the program
  1954.        terminates, otherwise the window is removed and the program continues.
  1955.  
  1956.  
  1957.  
  1958.  
  1959.  
  1960.  
  1961.  
  1962.  
  1963.  
  1964.  
  1965.  
  1966.  
  1967.  
  1968.  
  1969.  
  1970.  
  1971.  
  1972.  
  1973.  
  1974.  
  1975.  
  1976.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 30
  1977.  
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.        Section 6  MENU.TTT
  1992.  
  1993.        The  Menu   Kit  is   probably  the   most  useful   and   intelligent
  1994.        (artificially!) Kit  in the  whole package.  The best way of gaining a
  1995.        quick appreciation  of the  capabilities of  the menu  procedure is to
  1996.        execute the  DemoTTT.com file.  If you haven't done so already, run it
  1997.        now.
  1998.  
  1999.        The menus  generated are flexible in format. However the menus are all
  2000.        of the move-the-cursor and highlight-the-options style.
  2001.  
  2002.        All you  have to  do is define a record which contains the menu format
  2003.        details and  call the procedure DISPLAYMENU. The Toolkit does the rest
  2004.        and returns the chosen option.
  2005.  
  2006.        All you  have to  understand is  the menu  record. The  format of  the
  2007.        record is defined in Decl.TTT as follows:
  2008.  
  2009.  
  2010.  
  2011.        Menu_record = record
  2012.  
  2013.        Heading           :  string80;
  2014.        Text              :  array[1..Max_choices] of string80;
  2015.        TotalPicks        :  integer;
  2016.        PicksPerLine      :  byte;
  2017.        AddPrefix         :  byte;
  2018.        TopLeftXY         :  array[1..2] of byte;
  2019.        BoxType           :  byte;
  2020.        Colors            :  array[1..5] of byte;
  2021.        AllowEsc          :  boolean;
  2022.  
  2023.        end;
  2024.  
  2025.        In the examples that follow, it is assumed that a variable M of type
  2026.        menu_record has been defined e.g. Var M : Menu_record;
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 31
  2043.  
  2044.  
  2045.  
  2046.  
  2047.  
  2048.  
  2049.  
  2050.                              Section 6  Menu.TTT (cont.)
  2051.  
  2052.  
  2053.  
  2054.  
  2055.        Heading        If you want to have a heading at the top of the menu
  2056.                       then this is where you specify it e.g.
  2057.                                 M.Heading = 'The Main Menu';
  2058.                       If you do not want a heading then define it as a nul
  2059.                       string e.g. M.Heading = '';
  2060.  
  2061.        Text           This is the array of the actual menu prompts that will
  2062.                       be displayed in the menu. If there are 4 choices on the
  2063.                       menu then the declaration might be:
  2064.                                 M.Text[1] := 'View Reports on Screen';
  2065.                                 M.Text[2] := 'Send Reports to a Print File';
  2066.                                 M.Text[3] := 'Print the Reports';
  2067.                                 M.Text[4] := 'Quit';
  2068.  
  2069.        TotalPicks     Simply declare the total number of menu choices there
  2070.                       are e.g.
  2071.                                 M.TotalPicks := 4;
  2072.  
  2073.        PicksPerLine   Declare how many options you want to display on one
  2074.                       line of the screen e.g.
  2075.                                 M.PicksPerLine := 1;
  2076.  
  2077.        AddPrefix      The Menu Kit will, if required, automatically prefix
  2078.                       the options with Numbers, Letters or Function Keys. If
  2079.                       you do not want an option prefix then declare the
  2080.                       AddPrefix code as 0 e.g.
  2081.                                 M.AddPrefix := 0;
  2082.  
  2083.                       The other valid settings are 1,2, or 3. These function
  2084.                       as follows :
  2085.  
  2086.                       M.AddPrefix := 1;  -- this would cause the system to
  2087.                       prefix all the options with a single digit NUMBER. If
  2088.                       there are more than 9 options defined, the system will
  2089.                       prefix with a Alpha instead.
  2090.  
  2091.                       M.AddPrefix := 2;  -- this would cause the system to
  2092.                       prefix all the options with ALPHAS starting at A. If
  2093.                       there are more than 26 options defined, the system will
  2094.                       ignore the declaration and set AddPrefix to 0.
  2095.  
  2096.                       M.AddPrefix := 3;  -- this would cause the system to
  2097.                       prefix all the options with FUNCTION KEYS starting with
  2098.                       F1. If there are more than 10 options defined the
  2099.                       system will prefix with an Alpha instead.
  2100.  
  2101.                       When a non zero Prefix is operative the user simply has
  2102.                       to press the prefix of the desired option e.g. K or F5.
  2103.                       Alternatively they can move the cursor to highlight the
  2104.                       option and press enter.
  2105.  
  2106.  
  2107.  
  2108.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 32
  2109.  
  2110.  
  2111.  
  2112.  
  2113.  
  2114.  
  2115.  
  2116.                              Section 6  Menu.TTT (cont.)
  2117.  
  2118.  
  2119.  
  2120.  
  2121.        TopleftXY      This two byte array holds the X and Y coordinate for
  2122.                       the topleft corner of the menu. That's correct, you
  2123.                       only specify the topleft corner and the system will
  2124.                       calculate all the other dimensions. If you specify
  2125.                       coordinates for the topleft corner too close to the
  2126.                       screen edge, the system will automatically adjust the
  2127.                       coords in order to fully display the menu as close to
  2128.                       those coords as possible. If you set the X coord to 0
  2129.                       the system will automatically center the menu on the
  2130.                       screen. Assuming we want the menu to be displayed in
  2131.                       the center of the screen starting on the 7th line, the
  2132.                       declaration would be :
  2133.                                 M.TopleftXY[1] := 0;  {X coord}
  2134.                                 M.TopLeftXY[2] := 7;  {Y coord}
  2135.  
  2136.        BoxType        The boxtype is used to tell the system what type of box
  2137.                       around the menu. The settings are as follows:
  2138.                                 0         No box
  2139.                                 1         Single line box
  2140.                                 2         Double line box
  2141.                                 3         Single top/bottom double sides
  2142.                                 4         Double top/bottom single sides
  2143.  
  2144.                       If we wanted a single line box around our menu then the
  2145.                       declaration would be :
  2146.                                 M.Boxtype := 1;
  2147.  
  2148.        Colors         This is a 5 byte array defining all the colors to use.
  2149.  
  2150.                       Color 1 is the foreground color of the highlighted pick
  2151.                       Color 2 is the background color of the highlighted pick
  2152.                       Color 3 is the normal foreground color
  2153.                       Color 4 is the normal background color
  2154.                       Color 5 is the foreground color of the box
  2155.                       e.g.           M.Colors[1] := white;
  2156.                                      M.Colors[2] := red;
  2157.                                      M.Colors[3] := lightred;
  2158.                                      M.Colors[4] := black;
  2159.                                      M.Colors[5] := yellow;
  2160.  
  2161.        AllowEsc       The final part of the record is a boolean variable used
  2162.                       to indicate if the Esc key is operative i.e. can the
  2163.                       user escape from the menu? If it is set to false, the
  2164.                       Esc key is ignored. If it is set to true and the user
  2165.                       escapes, a Retcode is set to 99 (discussed later).In
  2166.                       our menu we do not want to allow the user to escape so
  2167.                       the declaration would be:
  2168.                                      M.AllowEsc := false;
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 33
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.                              Section 6  Menu.TTT (cont.)
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.        Once you have defined a menu record in the format described above, all
  2189.        you have to do is call the DISPLAYMENU procedure. 4 parameters have to
  2190.        be passed to the procedure as follows:
  2191.  
  2192.  
  2193.        The first parameter is the name of the menu_record variable e.g. M.
  2194.  
  2195.  
  2196.        The second parameter is a boolean (i.e. True or False) to indicate if
  2197.        the menu is to be displayed on a pulldown window. If this is True,
  2198.        after the user has chosen an option from the menu, the menu is removed
  2199.        and the original screen is restored. If it is set to false, the menu
  2200.        overwrites whatever was in that location on the screen.
  2201.  
  2202.  
  2203.        The third parameter is an integer variable that is returned to the
  2204.        calling procedure with the number of the selected option. The initial
  2205.        value of this parameter indicates which option to first highlight. For
  2206.        example, if we declared Pick to be an integer variable and set it to
  2207.        4, then the option highlighted on the menu would be the fourth one.
  2208.        After the user has selected an option the value of Pick will be the
  2209.        chosen option. You can then test on Pick and branch the program
  2210.        accordingly.
  2211.  
  2212.  
  2213.        The fourth and final parameter is an integer variable that is returned
  2214.        to the calling procedure with a value of 99 if the user escaped
  2215.        (assuming AllowEsc is set to true), otherwise it is set to 0.
  2216.  
  2217.  
  2218.  
  2219.  
  2220.  
  2221.  
  2222.  
  2223.  
  2224.  
  2225.  
  2226.  
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 34
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.                              Section 6  Menu.TTT (cont.)
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.        That's it, finally an example procedure based on the above
  2255.        information:
  2256.  
  2257.  
  2258.  
  2259.        Procedure My_Menu;
  2260.        var
  2261.        M : menu_record;
  2262.        Pick,Retcode : integer;
  2263.  
  2264.        begin
  2265.        With M do
  2266.        begin
  2267.         Heading := 'The Main Menu';
  2268.         Text[1] := 'View Reports on Screen';
  2269.         Text[2] := 'Send Reports to a Print File';
  2270.         Text[3] := 'Print the Reports';
  2271.         Text[4] := 'Quit':
  2272.         TotalPicks := 4;
  2273.         PicksPerLine := 1;
  2274.         AddPrefix := 3;
  2275.         TopleftXY[1] := 0;
  2276.         TopleftXY[2] := 7;
  2277.         BoxType := 1;
  2278.         Colors[1] := white;
  2279.         Colors[2] := red;
  2280.         Colors[3] := lightred;
  2281.         Colors[4] := black;
  2282.         Colors[5] := yellow;
  2283.         AllowEsc := false;
  2284.        end;    { with M}
  2285.        Pick := 4 ;        {default to Quit}
  2286.        DisplayMenu(M,false,Pick,Retcode);  {go do it!}
  2287.        Clrscr;
  2288.        Case Pick of
  2289.        1 : writeln('You chose 1');
  2290.        2 : writeln('You chose 2');
  2291.        3 : writeln('You chose 3');
  2292.        4 : writeln('You chose 4');
  2293.        end;  {case}
  2294.        end; {procedure My_menu}
  2295.  
  2296.        It's not too bad, is it? Incidentally, this example is in the
  2297.        demonstration file MenuTTT.Dem and is executable in MenuTTT.com.
  2298.  
  2299.  
  2300.  
  2301.  
  2302.  
  2303.  
  2304.  
  2305.  
  2306.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 35
  2307.  
  2308.  
  2309.  
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.        Section 7  IO.TTT
  2320.  
  2321.        The IO kit is used when you want to allow the user to enter one or
  2322.        more fields of information on the screen, providing them with the
  2323.        capability of editing (i.e. inserting, deleting etc) the data. If you
  2324.        haven't done so already, execute the DemoTTT.com file and select the
  2325.        IO option. A separate, smaller, demo is in the IOTTT.dem and IOTTT.com
  2326.        files.
  2327.  
  2328.        Some of the features of the IO kit include:
  2329.  
  2330.             *    Multiple input fields on each screen
  2331.             *    Optional descriptive messages displayed when editing a field
  2332.             *    Ability to call an independant help procedure
  2333.             *    Optional disabling of the Esc key
  2334.             *    Programmer defined editing keys
  2335.  
  2336.        In total there are ten procedures which control the IO process, but
  2337.        before we address them individually lets consider some of the basic
  2338.        principles.
  2339.  
  2340.        FORMATTING
  2341.  
  2342.        When you define an input field (discussed later) you can also specify
  2343.        the format of the input data. For example, you can define the field to
  2344.        be numeric and IO will only allow numeric input. The way you define
  2345.        the format of the input is via pre-defined formatting characters.
  2346.        There are four such format characters:
  2347.  
  2348.             #    Only 0 to 9 and the '.' decimal point are allowed
  2349.  
  2350.             @    Only letters of the alphabet and punctuation are allowed
  2351.  
  2352.             *    Anything goes!
  2353.  
  2354.             !    All letters are converted to upper-case
  2355.  
  2356.        Any other characters are treated as fixed and for display only. For
  2357.        example, if the input field is a telephone number, then the format can
  2358.        be defined as '(###) ###-####' . The user will then only be able to
  2359.        input numbers and, after typing the first three numbers, the cursor
  2360.        will jump three positions to the right i.e. to the next # character.
  2361.  
  2362.        Note that all user input data is treated as string data. The string
  2363.        returned by the IO procedures does not include the non-standard
  2364.        formatting characters. In the above example the string returned would
  2365.        be nine numbers i.e. no parentheses or spaces. If you you want to get
  2366.        an integer from the user then you firstly use the format characters to
  2367.        control the input, you must then convert the returned string to an
  2368.        integer (or real or boolean, as necessary) using the standard Turbo
  2369.        Pascal string manipulation procedures and functions. [Or preferably
  2370.        using the procedures in the Misc.TTT kit!]
  2371.  
  2372.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 36
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.                               Section 7  IO.TTT (cont.)
  2381.  
  2382.  
  2383.        EDITING
  2384.  
  2385.        In-built within the IO kit are standard editing features which are not
  2386.        available with the plain old READ(kbd) procedure. The editing keys are
  2387.        as follows:
  2388.  
  2389.        CursorUp  - the cursor moves 'up' to the previous input field (note
  2390.                  that you define what the previous input field is --
  2391.                  discussed later).
  2392.  
  2393.        CursorDown - the cursor moves 'down' to the next input field
  2394.  
  2395.        Ctrl-CursorLeft  - the cursor moves 'left' to the previous input field
  2396.  
  2397.        Ctrl-CursorRight - the cursor moves 'right' to the next input field
  2398.  
  2399.        CursorRight  - the cursor moves to the next character to the right in
  2400.                       the same input field. If it is already one character
  2401.                       past the last typed character it will not move.
  2402.  
  2403.        CursorLeft   - the cursor moves left one character in the same input
  2404.                       field. If the cursor is in position one it will not
  2405.                       move.
  2406.  
  2407.        Del          - deletes the character at the cursor. If there are any
  2408.                       non-standard formatting characters (e.g. parentheses in
  2409.                       the telephone number example) then the deleted
  2410.                       character is replaced with a space, otherwise all
  2411.                       characters to the right are shifted left on position.
  2412.  
  2413.        Backspace    - same as Del except the character to the left of the
  2414.                       cursor is affected.
  2415.  
  2416.        Tab          - move the cursor to the next input field to the 'right',
  2417.                       same as Ctrl-CursorRight.
  2418.  
  2419.        Shift-Tab    - move the cursor to the previous input field to the
  2420.                       'left', same as Ctrl-CursorLeft.
  2421.  
  2422.        F1           - invoke a help procedure if one has been defined.
  2423.  
  2424.        Ins          - toggles between insert and overlay mode. The cursor is
  2425.                       expanded to half a character in depth when the insert
  2426.                       mode is on.
  2427.  
  2428.        Esc          - end the edit session, if the escape facility is
  2429.                       enabled.
  2430.  
  2431.        Enter        - move the cursor to the next input field to the 'right'.
  2432.  
  2433.        End          - end the input session and proceed with the program.
  2434.  
  2435.        Note that all these keys are defined in the Decl.TTT file and you can
  2436.        modify them to meet your own needs and preferences.
  2437.  
  2438.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 37
  2439.  
  2440.  
  2441.  
  2442.  
  2443.  
  2444.  
  2445.  
  2446.                               Section 7  IO.TTT (cont.)
  2447.  
  2448.  
  2449.        Of the ten procedures in the IO kit there are 6 optional procedures
  2450.        and 4 mandatory procedures. Let us consider the 4 mandatory procedures
  2451.        first.
  2452.  
  2453.        IO_Setfields
  2454.  
  2455.        This procedure must be the first IO procedure and you simply pass the
  2456.        total number of input fields that will be defined. For example,
  2457.        IO_Setfields(5) advises the system that 5 input fields will be defined
  2458.        on the next input screen. Note that this procedure allocates
  2459.        sufficient space on the heap for the input field details and must
  2460.        therefore be called before all the other IO procedures.
  2461.  
  2462.        IO_DefineStr
  2463.  
  2464.        This is the workhorse procedure where you define all the
  2465.        characteristics of the input fields. A basic principle of the IO
  2466.        procedures is that each input field has an ID number and this is a key
  2467.        element of this procedure. The syntax is as follows :
  2468.  
  2469.             IO_DefineStr(ID,
  2470.                          U,D,L,R,
  2471.                          X,Y: byte;
  2472.                          var DefString : string80;
  2473.                          DefFormat     : string80);
  2474.  
  2475.        Where:
  2476.  
  2477.        ID is the aforementioned ID number for this input field. It is logical
  2478.        (but not mandatory) to start with ID number 1 and increment by one as
  2479.        you define each field.
  2480.  
  2481.        U,D,L,R are four bytes which represent the ID's of the fields which
  2482.        the cursor should move to if the up, down, left or right edit keys are
  2483.        pressed, respectively. For example,   5,2,5,2    would state that if
  2484.        the up or left keys are pressed, the cursor will move to field ID 5,
  2485.        and if the down or right keys are pressed the cursor will move to
  2486.        field ID 2. Got it? Note that these entries are not validated and it
  2487.        is up to you to make sure the entries are sensible e.g. don't put ID 6
  2488.        as the down field if there are only 5 fields in total. One exception
  2489.        is that an ID of zero (0) indicates that the input session will
  2490.        terminate (as if the End key had been pressed). This is a useful tool
  2491.        if you want to end a session after the last field has been updated and
  2492.        the user tries to move forward to the next input field.
  2493.  
  2494.        X,Y simply represent the X and Y coordinates of the first character in
  2495.        the input field. This is how you tell the system the location of the
  2496.        field on the screen.
  2497.  
  2498.        DefString is a previously declared parameter of type string80 which is
  2499.        returned from the IO procedure with the user's input. If you want to
  2500.        provide the user with a default entry then set the value of DefString
  2501.        to the required default string, otherwise set it to null i.e. ''.
  2502.  
  2503.  
  2504.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 38
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.                               Section 7  IO.TTT (cont.)
  2513.  
  2514.  
  2515.        The final parameter is DefFormat which is the format of the input
  2516.        field (as discussed previously under the sub-heading FORMATTING).
  2517.  
  2518.        Phew! Well it is the main procedure. Note that there must be one
  2519.        DefString statement for each of the input fields as defined in
  2520.        IO_SetFields.
  2521.  
  2522.  
  2523.  
  2524.        IO_Edit
  2525.  
  2526.        When you have declared all the parameters and defined all the IO
  2527.        procedures (including any optional procedures such as color changes)
  2528.        then you're ready to let the user input and update the fields. IO_Edit
  2529.        does this and passes control to the user. The procedure returns
  2530.        control to your program when the user has ended the update session; by
  2531.        pressing End or Esc (if it is enabled) or by pressing any of the move
  2532.        to next field keys (Enter, Tab, etc.) when the next field has been
  2533.        defined as ID zero. When the IO_Edit procedure is called you must pass
  2534.        an integer variable. This variable is updated with a return code for
  2535.        the edit session. The return codes are : 0 for successful completion;
  2536.        1 if user pressed Esc key 1; 2 if user pressed the alternate Esc key
  2537.        (if defined).
  2538.  
  2539.        IO_ResetFields
  2540.  
  2541.        This procedure is normally the next statement after IO_Edit. It
  2542.        discards all the field definitions from the Heap and sets all the
  2543.        optional settings (such as color) back to the default values.
  2544.  
  2545.  
  2546.  
  2547.        Well, those are the four mandatory procedures. You can repeat the
  2548.        definitions and procedures as often as you like in a program to
  2549.        provide multiple screen input. Discussed below are those optional
  2550.        procedures which you can use to alter the default settings:
  2551.  
  2552.        IO_AllowEsc(OK:boolean);
  2553.  
  2554.        This procedure is used to indicate whether the Esc key is disabled or
  2555.        enabled. The default is Esc disabled but if you want to enable the Esc
  2556.        key, simply include the following statement : IO_AllowEsc(True);.
  2557.  
  2558.  
  2559.  
  2560.        IO_SoundBeeper(OK:boolean);
  2561.  
  2562.        This procedure is used to switch on or off the (annoying) beep that
  2563.        sounds when the user presses an invalid key. The default is On but if
  2564.        you want to silence the bugger, include the following statement :
  2565.        IO_SoundBeeper(False);.
  2566.  
  2567.  
  2568.  
  2569.  
  2570.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 39
  2571.  
  2572.  
  2573.  
  2574.  
  2575.  
  2576.  
  2577.  
  2578.                               Section 7  IO.TTT (cont.)
  2579.  
  2580.  
  2581.        IO_SetColors(HiFore,HiBack,LoFore,LoBack,MsgFore,MsgBack:byte);
  2582.  
  2583.        Believe it or not, some people don't like my choice of colors. This
  2584.        procedure is used to set the colors to your preferred values. Note
  2585.        that the background colors should be in the range 0 to 7 (black to
  2586.        lightgray) to avoid the retarded IBM flashing effect.
  2587.  
  2588.  
  2589.  
  2590.        IO_DisplayFields;
  2591.  
  2592.        Normally the fields are not displayed on the screen until the IO_Edit
  2593.        procedure is called. But if you want to display the input fields
  2594.        before allowing the user to edit them then the include the statement
  2595.        IO_DisplayFields; . This is useful when you want to display the fields
  2596.        while placing some initial instructions in a window bfore freeing the
  2597.        user to update.
  2598.  
  2599.  
  2600.  
  2601.        IO_DefineMsg(DefID, DefX, DefY : byte;Defstring : string80);
  2602.  
  2603.        You can display a message when the user moves to any input field. When
  2604.        the user exits the field the message is removed and the original
  2605.        screen contents (that were overlayed by the message) is restored. You
  2606.        can define unique messages for one, some or all the input fields. The
  2607.        parameters of this procedure are used to indicate the field ID to
  2608.        which the message is to be attached, the X and Y coordinates of the
  2609.        start of the message, and the message string itself, respectively.
  2610.  
  2611.  
  2612.  
  2613.        IO_HelpProc(location : integer);
  2614.  
  2615.        This procedure allows you to pass the address or location of a help
  2616.        procedure that will be called when the help key is pressed. Before
  2617.        calling this procedure you must have already declared and defined the
  2618.        help procedure that you want to be called. Also the procedure must be
  2619.        declared at the root level of the program -- it must not be nested
  2620.        within another procedure. The simplest way of passing the location is
  2621.        to use the Turbo Pascal ofs function. For example, lets say you have
  2622.        written a help procedure called Instructions, you would then include
  2623.        the statement IO_HelpProc(ofs(Instructions)); .
  2624.  
  2625.  
  2626.  
  2627.  
  2628.  
  2629.  
  2630.  
  2631.  
  2632.  
  2633.  
  2634.  
  2635.  
  2636.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 40
  2637.  
  2638.  
  2639.  
  2640.  
  2641.  
  2642.  
  2643.  
  2644.                               Section 7  IO.TTT (cont.)
  2645.  
  2646.  
  2647.  
  2648.  
  2649.        Well, that's enough theory. The IO kit is extensive and the
  2650.        documentation is commensurately long. Nonetheless the kit is designed
  2651.        to be easy to use and most of the defaults are acceptable (nay,
  2652.        wonderful). Just remember that you must call the 4 mandatory
  2653.        procedures as follows:
  2654.                                 IO_Setfields
  2655.                                 IO_DefineStr
  2656.                                 IO_Edit
  2657.                                 IO_Resetfields
  2658.  
  2659.        The best way to become familiar with the IO kit is to look at, and
  2660.        write, small examples. Refer back to the file IOTTT.dem and see if you
  2661.        understand it.
  2662.  
  2663.        The following simple program illustrates an input screen for
  2664.        requesting the user's name, age and phone number.
  2665.  
  2666.        Program Find_A_Date;
  2667.  
  2668.        {$I Decl.TTT}
  2669.        {$I Fastwrit.TTT}
  2670.        {$I Misc.TTT}
  2671.        {$I IO.TTT}
  2672.  
  2673.        const
  2674.        Name,
  2675.        Age,
  2676.        Phone : string80 = '';
  2677.        var
  2678.        Code : integer;
  2679.  
  2680.        begin
  2681.        IO_SetFields(3);
  2682.        IO_SoundBeeper(False);
  2683.        IO_AllowEsc(true);
  2684.        IO_DefineStr(1,   3,2,3,2,   35,10,   Name, '!!!!!!!!!!!!!!!!');
  2685.        IO_DefineStr(2,   1,3,1,3,   35,12,   Age,  '##');
  2686.        IO_DefineStr(3,   2,1,2,1,   35,14,   Phone,'(###) ###-####');
  2687.        Clrscr;
  2688.        WriteAT(28,10,yellow,black,'NAME:');
  2689.        WriteAT(28,12,yellow,black,'AGE:');
  2690.        WriteAT(28,14,yellow,black,'PHONE:');
  2691.        IO_Edit(code);
  2692.        IO_ResetFields;
  2693.        End.
  2694.  
  2695.  
  2696.  
  2697.  
  2698.  
  2699.  
  2700.  
  2701.  
  2702.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 41
  2703.  
  2704.  
  2705.  
  2706.  
  2707.  
  2708.  
  2709.  
  2710.  
  2711.  
  2712.  
  2713.  
  2714.  
  2715.        Section 8  MISC.TTT
  2716.  
  2717.        The Misc.TTT kit contains a pot pourri of procedures and functions
  2718.        which either do not obviously fit in any of the other kits, or are
  2719.        used by two or more of the kits. I have restricted the size of this
  2720.        file in order to reduce the compile time. This file is constantly
  2721.        being modified and improved, but at the time of going to press, the
  2722.        following procedures and functions were available:
  2723.  
  2724.                                      Beep
  2725.                                      Printscreen
  2726.                                      Wait_for_Keypress
  2727.                                      FlushKeyBuffer
  2728.                                      Replicate
  2729.                                      Int_to_Str
  2730.                                      Real_to_Str
  2731.                                      Printer_Ready
  2732.                                      Time
  2733.                                      Date
  2734.                                      MemAvail_in_Bytes
  2735.  
  2736.  
  2737.  
  2738.  
  2739.  
  2740.  
  2741.  
  2742.  
  2743.  
  2744.  
  2745.  
  2746.  
  2747.  
  2748.  
  2749.  
  2750.  
  2751.  
  2752.  
  2753.  
  2754.  
  2755.  
  2756.  
  2757.  
  2758.  
  2759.  
  2760.  
  2761.  
  2762.  
  2763.  
  2764.  
  2765.  
  2766.  
  2767.  
  2768.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 42
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.  
  2776.                              Section 8  Misc.TTT (cont.)
  2777.  
  2778.  
  2779.        Procedure                BEEP
  2780.  
  2781.        Purpose                  To emit a short alarm from the speaker
  2782.  
  2783.        Syntax                   Beep;
  2784.  
  2785.  
  2786.  
  2787.        Example:
  2788.  
  2789.        {$I Decl.TTT}
  2790.        {$I Misc.TTT}
  2791.  
  2792.        begin
  2793.        If not (Choice in ['Q','1'..'5']) then Beep;
  2794.        end;
  2795.  
  2796.  
  2797.  
  2798.        The above code fragment will result in a beep if the value of Choice
  2799.        is not Q or a number in the range 1 to 5.
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822.  
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.  
  2832.  
  2833.  
  2834.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 43
  2835.  
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841.  
  2842.                              Section 8  Misc.TTT (cont.)
  2843.  
  2844.  
  2845.  
  2846.        Procedure                PRINTSCREEN
  2847.  
  2848.        Purpose                  To send a copy of text screen to printer
  2849.  
  2850.        Syntax                   PrintScreen;
  2851.  
  2852.        Notes     1)   This procedures emulates the PrtSc key on the keyboard
  2853.  
  2854.  
  2855.  
  2856.        Example:
  2857.  
  2858.        {$I Decl.TTT}
  2859.        {$I Misc.TTT}
  2860.  
  2861.        begin
  2862.        If Answer = 'Y' then Printscreen;
  2863.        end;
  2864.  
  2865.  
  2866.  
  2867.        The above code fragment simply dumps the screen image to the printer
  2868.        if the value of Answer is Y.
  2869.  
  2870.  
  2871.  
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878.  
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.  
  2888.  
  2889.  
  2890.  
  2891.  
  2892.  
  2893.  
  2894.  
  2895.  
  2896.  
  2897.  
  2898.  
  2899.  
  2900.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 44
  2901.  
  2902.  
  2903.  
  2904.  
  2905.  
  2906.  
  2907.  
  2908.                              Section 8  Misc.TTT (cont.)
  2909.  
  2910.  
  2911.  
  2912.        Procedure                WAIT_FOR_KEYPRESS
  2913.  
  2914.        Purpose                  To pause a program for user to press a key
  2915.  
  2916.        Syntax                   Wait_For_Keypress(var Ch:char);
  2917.  
  2918.                  where               Ch is a character variable
  2919.  
  2920.        Notes     1)   The procedure updates the value of Ch with the key that
  2921.                       was pressed. If the key was extended (e.g. the function
  2922.                       keys) then the extended scan code is returned and the
  2923.                       global boolean variable Funckey is set to true.
  2924.  
  2925.  
  2926.  
  2927.        Example:
  2928.  
  2929.        {$I Decl.TTT}
  2930.        {$I Misc.TTT}
  2931.  
  2932.        var Answer : char;
  2933.  
  2934.        begin
  2935.        Wait_For_Keypress(Answer);
  2936.        If Funckey = true then
  2937.        Case upcase(Answer) of
  2938.        F1    :    Help;
  2939.        F2    :    AddData;
  2940.        F3    :    DelData;
  2941.        F4    :    ChaData;
  2942.        F5    :    Quit;
  2943.        else Beep;
  2944.        end; {case}
  2945.        end;
  2946.  
  2947.        The above code fragment represents part of a menu system. The system
  2948.        pauses for the user to press a key. If a function key is pressed and
  2949.        it is in the range 1 to 5 then another procedure is called, otherwise
  2950.        the system beeps.
  2951.  
  2952.  
  2953.  
  2954.  
  2955.  
  2956.  
  2957.  
  2958.  
  2959.  
  2960.  
  2961.  
  2962.  
  2963.  
  2964.  
  2965.  
  2966.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 45
  2967.  
  2968.  
  2969.  
  2970.  
  2971.  
  2972.  
  2973.  
  2974.                              Section 8  Misc.TTT (cont.)
  2975.  
  2976.  
  2977.  
  2978.        Procedure           FLUSHKEYBUFFER
  2979.  
  2980.        Purpose             To remove any keystrokes from the keyboard buffer
  2981.  
  2982.        Syntax              FlushKeyBuffer;
  2983.  
  2984.  
  2985.  
  2986.        Example:
  2987.  
  2988.        {$I Decl.TTT}
  2989.        {$I Misc.TTT}
  2990.  
  2991.        var Answer : char;
  2992.  
  2993.        begin
  2994.        Write('Are you sure you want to delete the record? (Y/N)');
  2995.        FlushKeyBuffer;
  2996.        Wait_For_KeyPress(Answer);
  2997.        If (Funckey = false) and (upcase(Answer) = 'Y') then DelRecord;
  2998.        end;
  2999.  
  3000.  
  3001.  
  3002.        The above code fragment illustrates the most common use of the
  3003.        FlushKeyBuffer procedure. The procedure prompts the user for a
  3004.        response e.g. do they really want to delete the record? The
  3005.        FlushKeyBuffer procedure is then called to dispose of any surplus
  3006.        keystrokes that may be held in the keyboard buffer. Then the system
  3007.        pauses for a user response, and if they answer Y then then record
  3008.        deletion procedure DelRecord is called.
  3009.  
  3010.  
  3011.  
  3012.  
  3013.  
  3014.  
  3015.  
  3016.  
  3017.  
  3018.  
  3019.  
  3020.  
  3021.  
  3022.  
  3023.  
  3024.  
  3025.  
  3026.  
  3027.  
  3028.  
  3029.  
  3030.  
  3031.  
  3032.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 46
  3033.  
  3034.  
  3035.  
  3036.  
  3037.  
  3038.  
  3039.  
  3040.                              Section 8  Misc.TTT (cont.)
  3041.  
  3042.  
  3043.  
  3044.        Function                 REPLICATE
  3045.  
  3046.        Purpose                  To return a string of a repeated character
  3047.  
  3048.        Syntax                   Replicate(N:byte;Character:char)string80;
  3049.  
  3050.                       where          N is the number of repetitions (1..80)
  3051.                                      Character is the character to repeat
  3052.  
  3053.        Notes     1)   If N is outside the range 1..80 then a single character
  3054.                       string is returned.
  3055.  
  3056.                  2)   The function is much faster than a For loop.
  3057.  
  3058.  
  3059.  
  3060.        Example:
  3061.  
  3062.        {$I Decl.TTT}
  3063.        {$I Misc.TTT}
  3064.  
  3065.        begin
  3066.        Write(Replicate(80,'*'));
  3067.        end;
  3068.  
  3069.        This code fragment will write a string of 80 asterisks (*).
  3070.  
  3071.  
  3072.  
  3073.  
  3074.  
  3075.  
  3076.  
  3077.  
  3078.  
  3079.  
  3080.  
  3081.  
  3082.  
  3083.  
  3084.  
  3085.  
  3086.  
  3087.  
  3088.  
  3089.  
  3090.  
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 47
  3099.  
  3100.  
  3101.  
  3102.  
  3103.  
  3104.  
  3105.  
  3106.                              Section 8  Misc.TTT (cont.)
  3107.  
  3108.  
  3109.  
  3110.        Function                 INT_TO_STR
  3111.  
  3112.        Purpose                  To convert an integer to a string
  3113.  
  3114.        Syntax                   Int_to_Str(Number:integer):string20;
  3115.  
  3116.                  where               Number is the integer to be converted
  3117.  
  3118.        Notes          1)   No error checking is performed by this function
  3119.  
  3120.  
  3121.  
  3122.        Example:
  3123.  
  3124.        {$I Decl.TTT}
  3125.        {$I Misc.TTT}
  3126.  
  3127.        var Message : string80;
  3128.  
  3129.        begin
  3130.        Message := 'That is a total of '+Int_to_Str(Strokes)+'for 18 holes');
  3131.        end;
  3132.  
  3133.        Assuming Strokes is an integer variable, value 67, then the message
  3134.        string would be 'That is a total of 67 for 18 holes'.
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158.  
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 48
  3165.  
  3166.  
  3167.  
  3168.  
  3169.  
  3170.  
  3171.  
  3172.                              Section 8  Misc.TTT (cont.)
  3173.  
  3174.  
  3175.        Function                 REAL_TO_STR
  3176.  
  3177.        Purpose                  To convert a real number to a string
  3178.  
  3179.        Syntax                   Real_to_Str(N:real;D:byte):string20;
  3180.  
  3181.                       where          N    is a real number
  3182.                                      D    is the number of decimal places
  3183.  
  3184.        Notes          1)   This function returns a string with no leading
  3185.                            spaces.
  3186.  
  3187.  
  3188.  
  3189.        Example:
  3190.  
  3191.        {$I Decl.TTT}
  3192.        {$I Misc.TTT}
  3193.  
  3194.        var Message : string80;
  3195.  
  3196.        begin
  3197.        Message := 'The answer '+Real_to_Str(Result,3)+' is correct');
  3198.        end;
  3199.  
  3200.        Assuming Result is a real variable of value 367.8000000 then the
  3201.        message string would be 'The answer 367.800 is correct'.
  3202.  
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214.  
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.  
  3224.  
  3225.  
  3226.  
  3227.  
  3228.  
  3229.  
  3230.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 49
  3231.  
  3232.  
  3233.  
  3234.  
  3235.  
  3236.  
  3237.  
  3238.                              Section 8  Misc.TTT (cont.)
  3239.  
  3240.  
  3241.  
  3242.        Function                 STR_TO_INT
  3243.  
  3244.        Purpose                  To convert a string to an integer
  3245.  
  3246.        Syntax                   Str_to_Int(Str:string80):integer;
  3247.  
  3248.                  where          Str  is the string to be converted
  3249.  
  3250.        Notes     1)   If the string is not a valid format then a zero is
  3251.                       returned.
  3252.  
  3253.  
  3254.  
  3255.        Example:
  3256.  
  3257.        {$I Decl.TTT}
  3258.        {$I Misc.TTT}
  3259.  
  3260.        var result : integer;
  3261.  
  3262.        Const A = '23';B ='16';
  3263.  
  3264.        begin
  3265.        Result := Str_to_Int(A) + Str_to_Int(B);
  3266.        end;
  3267.  
  3268.        The integer variable Result would be assigned the value 39.
  3269.  
  3270.  
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.  
  3280.  
  3281.  
  3282.  
  3283.  
  3284.  
  3285.  
  3286.  
  3287.  
  3288.  
  3289.  
  3290.  
  3291.  
  3292.  
  3293.  
  3294.  
  3295.  
  3296.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 50
  3297.  
  3298.  
  3299.  
  3300.  
  3301.  
  3302.  
  3303.  
  3304.                              Section 8  Misc.TTT (cont.)
  3305.  
  3306.  
  3307.  
  3308.        Function            PRINTER_READY
  3309.  
  3310.        Purpose             To determine if the printer is connected on-line
  3311.  
  3312.        Syntax              Printer_Ready:boolean;
  3313.  
  3314.        Notes     1)   This function is most useful, when you want to bullet
  3315.                       proof a printer option and mnake sure that a printer is
  3316.                       attached and on-line before trying to route any reports
  3317.                       to it.
  3318.  
  3319.  
  3320.  
  3321.        Example:
  3322.  
  3323.        {$I Decl.TTT}
  3324.        {$I Misc.TTT}
  3325.  
  3326.        begin
  3327.        If Printer_Ready then PrintScreen;
  3328.        end;
  3329.  
  3330.        This code fragment checks to see if the printer is on-line and, if it
  3331.        is, a dump of the screen is printed.
  3332.  
  3333.  
  3334.  
  3335.  
  3336.  
  3337.  
  3338.  
  3339.  
  3340.  
  3341.  
  3342.  
  3343.  
  3344.  
  3345.  
  3346.  
  3347.  
  3348.  
  3349.  
  3350.  
  3351.  
  3352.  
  3353.  
  3354.  
  3355.  
  3356.  
  3357.  
  3358.  
  3359.  
  3360.  
  3361.  
  3362.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 51
  3363.  
  3364.  
  3365.  
  3366.  
  3367.  
  3368.  
  3369.  
  3370.                              Section 8  Misc.TTT (cont.)
  3371.  
  3372.  
  3373.  
  3374.        Function            TIME
  3375.  
  3376.        Purpose             To return the system time formatted nicely
  3377.  
  3378.        Syntax              Time:string20;
  3379.  
  3380.        Notes     1)   The format of the returned string is hour:min:sec a.m.
  3381.                       or hour:min:sec p.m. .
  3382.  
  3383.        Example:
  3384.  
  3385.        {$I Decl.TTT}
  3386.        {$I Misc.TTT}
  3387.  
  3388.        begin
  3389.        ClrScr;
  3390.        Write(Time);
  3391.        end;
  3392.  
  3393.        The above code fragment will clear the screen and print the time in
  3394.        the top left corner.
  3395.  
  3396.  
  3397.  
  3398.  
  3399.  
  3400.  
  3401.  
  3402.  
  3403.  
  3404.  
  3405.  
  3406.  
  3407.  
  3408.  
  3409.  
  3410.  
  3411.  
  3412.  
  3413.  
  3414.  
  3415.  
  3416.  
  3417.  
  3418.  
  3419.  
  3420.  
  3421.  
  3422.  
  3423.  
  3424.  
  3425.  
  3426.  
  3427.  
  3428.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 52
  3429.  
  3430.  
  3431.  
  3432.  
  3433.  
  3434.  
  3435.  
  3436.                              Section 8  Misc.TTT (cont.)
  3437.  
  3438.  
  3439.  
  3440.        Function                 DATE
  3441.  
  3442.        Purpose                  To return the system date nicely formatted
  3443.  
  3444.        Syntax                   Date:string30;
  3445.  
  3446.        Notes     1)   The format of the returned string is the day followed
  3447.                       by the month, day of month and year e.g.
  3448.                            Wednesday October 1, 1986
  3449.  
  3450.        Example:
  3451.  
  3452.        {$I Decl.TTT}
  3453.        {$I Misc.TTT}
  3454.  
  3455.        begin
  3456.        ClrScr;
  3457.        Write(date);
  3458.        end;
  3459.  
  3460.        The above code fragment would clear the screen and write the date in
  3461.        the top left corner.
  3462.  
  3463.  
  3464.  
  3465.  
  3466.  
  3467.  
  3468.  
  3469.  
  3470.  
  3471.  
  3472.  
  3473.  
  3474.  
  3475.  
  3476.  
  3477.  
  3478.  
  3479.  
  3480.  
  3481.  
  3482.  
  3483.  
  3484.  
  3485.  
  3486.  
  3487.  
  3488.  
  3489.  
  3490.  
  3491.  
  3492.  
  3493.  
  3494.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 53
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.                              Section 8  Misc.TTT (cont.)
  3503.  
  3504.  
  3505.  
  3506.        Function                 MEMAVAIL_IN_BYTES
  3507.  
  3508.        Purpose                  To return the total heap space available
  3509.  
  3510.        Syntax                   MemAvail_in_Bytes:real;
  3511.  
  3512.        Notes     1)   This function is used in the heap management procedures
  3513.                       and returns how much heap space is available. It should
  3514.                       be called prior to a New(variable) statement to ensure
  3515.                       there is enough room for the variable on the Heap.
  3516.  
  3517.  
  3518.  
  3519.        Example:
  3520.  
  3521.        {$I Decl.TTT}
  3522.        {$I Misc.TTT}
  3523.  
  3524.        type
  3525.        RecPtr = ^Rec;
  3526.        Rec = record
  3527.                  Value : real;
  3528.                  Monster : Array[1..Maxavail] of integer;
  3529.              end;
  3530.  
  3531.        var
  3532.  
  3533.        Heapvar : RecPtr;
  3534.  
  3535.        begin
  3536.        If MemAvail_in_Bytes > Sizeof(Heapvar^) then New(Heapvar);
  3537.        end;
  3538.  
  3539.        This code segment checks to see if there is enough heap space
  3540.        available to allocate the variable. If there is, the space is
  3541.        allocated with the New statement.
  3542.  
  3543.  
  3544.  
  3545.  
  3546.  
  3547.  
  3548.  
  3549.  
  3550.  
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.  
  3560.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 54
  3561.  
  3562.  
  3563.  
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.                                        Index
  3582.  
  3583.                 A Full List of Technojocks Procedures and Functions
  3584.                 sorted by page number, by TTT file, & alphabetically
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606.  
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.  
  3616.  
  3617.  
  3618.  
  3619.  
  3620.  
  3621.  
  3622.  
  3623.  
  3624.  
  3625.  
  3626.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 55
  3627.  
  3628.  
  3629.  
  3630.  
  3631.  
  3632.  
  3633.  
  3634.  
  3635.  
  3636.  
  3637.                                In Page Number Order
  3638.  
  3639.            Proc/Func                Filename                     Page
  3640.            Box                      Fastwrit.TTT ...............  9
  3641.            Horizline                Fastwrit.TTT ............... 10
  3642.            Vertline                 Fastwrit.TTT ............... 11
  3643.            WriteAT                  Fastwrit.TTT ............... 12
  3644.            ClearText                Fastwrit.TTT ............... 13
  3645.            WriteCenter              Fastwrit.TTT ............... 14
  3646.            WriteBetween             Fastwrit.TTT ............... 15
  3647.            WriteVert                Fastwrit.TTT ............... 16
  3648.            TempMessage              Fastwrit.TTT ............... 17
  3649.            FindCursor               Fastwrit.TTT ............... 18
  3650.            PosCursor                Fastwrit.TTT ............... 19
  3651.            SizeCursor               Fastwrit.TTT ............... 20
  3652.            OffCursor                Fastwrit.TTT ............... 21
  3653.            OnCursor                 Fastwrit.TTT ............... 22
  3654.            VideoOff                 Fastwrit.TTT ............... 23
  3655.            VideoOn                  Fastwrit.TTT ............... 24
  3656.            SaveScreen               Window.TTT ................. 26
  3657.            RestoreScreen            Window.TTT ................. 27
  3658.            DisposeScreen            Window.TTT ................. 28
  3659.            MkWin                    Window.TTT ................. 29
  3660.            RmWin                    Window.TTT ................. 30
  3661.            DisplayMenu              Menu.TTT ................... 31
  3662.            IO_Setfields             IO.TTT ..................... 38
  3663.            IO_DefineStr             IO.TTT ..................... 38
  3664.            IO_ResetFields           IO.TTT ..................... 39
  3665.            IO_AllowEsc              IO.TTT ..................... 39
  3666.            IO_Edit                  IO.TTT ..................... 39
  3667.            IO_SoundBeeper           IO.TTT ..................... 39
  3668.            IO_DisplayFields         IO.TTT ..................... 40
  3669.            IO_SetColors             IO.TTT ..................... 40
  3670.            IO_HelpProc              IO.TTT ..................... 40
  3671.            IO_DefineMsg             IO.TTT ..................... 40
  3672.            Beep                     Misc.TTT ................... 43
  3673.            PrintScreen              Misc.TTT ................... 44
  3674.            Wait_for_Keypress        Misc.TTT ................... 45
  3675.            FlushKeyBuffer           Misc.TTT ................... 46
  3676.            Replicate                Misc.TTT ................... 47
  3677.            Int_to_Str               Misc.TTT ................... 48
  3678.            Real_to_Str              Misc.TTT ................... 49
  3679.            Str_to_Int               Misc.TTT ................... 50
  3680.            Printer_Ready            Misc.TTT ................... 51
  3681.            Time                     Misc.TTT ................... 52
  3682.            Date                     Misc.TTT ................... 53
  3683.            MemAvail_in_Bytes        Misc.TTT ................... 54
  3684.  
  3685.  
  3686.  
  3687.  
  3688.  
  3689.  
  3690.  
  3691.  
  3692.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 56
  3693.  
  3694.  
  3695.  
  3696.  
  3697.  
  3698.  
  3699.  
  3700.  
  3701.  
  3702.  
  3703.                                By File Alphabetically
  3704.            Proc/Func                Filename                     Page
  3705.            Box                      Fastwrit.TTT ...............  9
  3706.            ClearText                Fastwrit.TTT ............... 13
  3707.            FindCursor               Fastwrit.TTT ............... 18
  3708.            Horizline                Fastwrit.TTT ............... 10
  3709.            OffCursor                Fastwrit.TTT ............... 21
  3710.            OnCursor                 Fastwrit.TTT ............... 22
  3711.            PosCursor                Fastwrit.TTT ............... 19
  3712.            SizeCursor               Fastwrit.TTT ............... 20
  3713.            TempMessage              Fastwrit.TTT ............... 17
  3714.            Vertline                 Fastwrit.TTT ............... 11
  3715.            VideoOff                 Fastwrit.TTT ............... 23
  3716.            VideoOn                  Fastwrit.TTT ............... 24
  3717.            WriteAT                  Fastwrit.TTT ............... 12
  3718.            WriteBetween             Fastwrit.TTT ............... 15
  3719.            WriteCenter              Fastwrit.TTT ............... 14
  3720.            WriteVert                Fastwrit.TTT ............... 16
  3721.            IO_AllowEsc              IO.TTT ..................... 39
  3722.            IO_DefineMsg             IO.TTT ..................... 40
  3723.            IO_DefineStr             IO.TTT ..................... 38
  3724.            IO_DisplayFields         IO.TTT ..................... 40
  3725.            IO_Edit                  IO.TTT ..................... 39
  3726.            IO_HelpProc              IO.TTT ..................... 40
  3727.            IO_ResetFields           IO.TTT ..................... 39
  3728.            IO_SetColors             IO.TTT ..................... 40
  3729.            IO_Setfields             IO.TTT ..................... 38
  3730.            IO_SoundBeeper           IO.TTT ..................... 39
  3731.            DisplayMenu              Menu.TTT ................... 31
  3732.            Beep                     Misc.TTT ................... 43
  3733.            Date                     Misc.TTT ................... 53
  3734.            FlushKeyBuffer           Misc.TTT ................... 46
  3735.            Int_to_Str               Misc.TTT ................... 48
  3736.            MemAvail_in_Bytes        Misc.TTT ................... 54
  3737.            Printer_Ready            Misc.TTT ................... 51
  3738.            PrintScreen              Misc.TTT ................... 44
  3739.            Real_to_Str              Misc.TTT ................... 49
  3740.            Replicate                Misc.TTT ................... 47
  3741.            Str_to_Int               Misc.TTT ................... 50
  3742.            Time                     Misc.TTT ................... 52
  3743.            Wait_for_Keypress        Misc.TTT ................... 45
  3744.            DisposeScreen            Window.TTT ................. 28
  3745.            MkWin                    Window.TTT ................. 29
  3746.            RestoreScreen            Window.TTT ................. 27
  3747.            RmWin                    Window.TTT ................. 30
  3748.            SaveScreen               Window.TTT ................. 26
  3749.  
  3750.  
  3751.  
  3752.  
  3753.  
  3754.  
  3755.  
  3756.  
  3757.  
  3758.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 57
  3759.  
  3760.  
  3761.  
  3762.  
  3763.  
  3764.  
  3765.  
  3766.  
  3767.  
  3768.  
  3769.                             By Proc/Func Alphabetically
  3770.  
  3771.            Proc/Func                Filename                     Page
  3772.            Beep                     Misc.TTT ................... 43
  3773.            Box                      Fastwrit.TTT ...............  9
  3774.            ClearText                Fastwrit.TTT ............... 13
  3775.            Date                     Misc.TTT ................... 53
  3776.            DisplayMenu              Menu.TTT ................... 31
  3777.            DisposeScreen            Window.TTT ................. 28
  3778.            FindCursor               Fastwrit.TTT ............... 18
  3779.            FlushKeyBuffer           Misc.TTT ................... 46
  3780.            Horizline                Fastwrit.TTT ............... 10
  3781.            Int_to_Str               Misc.TTT ................... 48
  3782.            IO_AllowEsc              IO.TTT ..................... 39
  3783.            IO_DefineMsg             IO.TTT ..................... 40
  3784.            IO_DefineStr             IO.TTT ..................... 38
  3785.            IO_DisplayFields         IO.TTT ..................... 40
  3786.            IO_Edit                  IO.TTT ..................... 39
  3787.            IO_HelpProc              IO.TTT ..................... 40
  3788.            IO_ResetFields           IO.TTT ..................... 39
  3789.            IO_SetColors             IO.TTT ..................... 40
  3790.            IO_Setfields             IO.TTT ..................... 38
  3791.            IO_SoundBeeper           IO.TTT ..................... 39
  3792.            MemAvail_in_Bytes        Misc.TTT ................... 54
  3793.            MkWin                    Window.TTT ................. 29
  3794.            OffCursor                Fastwrit.TTT ............... 21
  3795.            OnCursor                 Fastwrit.TTT ............... 22
  3796.            PosCursor                Fastwrit.TTT ............... 19
  3797.            Printer_Ready            Misc.TTT ................... 51
  3798.            PrintScreen              Misc.TTT ................... 44
  3799.            Real_to_Str              Misc.TTT ................... 49
  3800.            Replicate                Misc.TTT ................... 47
  3801.            RestoreScreen            Window.TTT ................. 27
  3802.            RmWin                    Window.TTT ................. 30
  3803.            SaveScreen               Window.TTT ................. 26
  3804.            SizeCursor               Fastwrit.TTT ............... 20
  3805.            Str_to_Int               Misc.TTT ................... 50
  3806.            TempMessage              Fastwrit.TTT ............... 17
  3807.            Time                     Misc.TTT ................... 52
  3808.            Vertline                 Fastwrit.TTT ............... 11
  3809.            VideoOff                 Fastwrit.TTT ............... 23
  3810.            VideoOn                  Fastwrit.TTT ............... 24
  3811.            Wait_for_Keypress        Misc.TTT ................... 45
  3812.            WriteAT                  Fastwrit.TTT ............... 12
  3813.            WriteBetween             Fastwrit.TTT ............... 15
  3814.            WriteCenter              Fastwrit.TTT ............... 14
  3815.            WriteVert                Fastwrit.TTT ............... 16
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.        Technojocks Turbo Toolkit  v3.0       Oct 1, 1986                 Page 58
  3825.  
  3826.